﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace KYKJ.Monitor.Login
{
    /// <summary>
    /// LoginWindow.xaml 的交互逻辑
    /// </summary>
    public partial class LoginWindow : Window
    {
        public LoginWindow()
        {
            InitializeComponent();
        }

        private void BtnClose_Click(object sender, RoutedEventArgs e)
        {
            DialogResult = false;
        }

        private void TextBlock_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            this.DragMove();
        }

        private void btnLogin_Click(object sender, RoutedEventArgs e)
        {
            bool result = CheckUserInput();
            if (result)
            {
                DialogResult = true;
            }
        }

        private bool CheckUserInput()
        {
            if (string.IsNullOrWhiteSpace(this.txtUser.Text.Trim()))
            {
                MessageBox.Show("用户名不能为空");
                return false;
            }
            if (string.IsNullOrWhiteSpace(this.passwordbox.Password.Trim()))
            {
                MessageBox.Show("密码不能为空");
                return false;
            }
            return true;
        }
    }
}
